package wordroid.business;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.StringTokenizer;
import wordroid.database.DataAccess;
import wordroid.model.Word;
import wordroid.model.WordList;

public class OperationOfBooks
{
  public static boolean ifContinue;

  private ArrayList<Word> initWordList(ArrayList<Word> paramArrayList, String paramString)
  {
    if (paramString.equals("luanxu"));
    for (int i = 0; ; ++i)
    {
      if (i >= paramArrayList.size());
//      do
//        return paramArrayList;
//      while (!(ifContinue));
      int j =  (int)(Math.random() * paramArrayList.size()); 
      String str = ((Word)paramArrayList.get(j)).getList();
      ((Word)paramArrayList.get(j)).setList(((Word)paramArrayList.get(i)).getList());
      ((Word)paramArrayList.get(i)).setList(str);
      Log.i("luan", ((Word)paramArrayList.get(i)).getList());
    }
  }

  public ArrayList<ArrayList<String>> GetPlan(int paramInt, Context paramContext)
  {
	return null;
	  /*   ArrayList localArrayList13;
    if (paramInt < 0)
    {
      localArrayList13 = null;
      return localArrayList13;
    }
    ArrayList localArrayList1 = new DataAccess(paramContext).QueryList("BOOKID = '" + DataAccess.bookID + "'", null);
    ArrayList localArrayList2 = new ArrayList();
    SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    int i = 0;
   // label69:
    	int j;
    Calendar localCalendar3;
    String[] arrayOfString;
    int k;
    if (i >= localArrayList1.size())
    {
      j = 0;
      if (j < localArrayList2.size())
     //   break label1364;
      localArrayList13 = new ArrayList();
      localCalendar3 = Calendar.getInstance();
      arrayOfString = new String[7];
      localCalendar3.add(5, paramInt * 7);
      k = 0;
     // if (k < 7)
    //    break label1482;
    }
    int i1;
    int i3;
    for (int l = 0; ; ++l)
    {
      if (l >= 7)
      {
        for (i1 = 0; ; ++i1)
        {
          int i2 = localArrayList2.size();
          if (i1 < i2);
//          i3 = 0;
//          if (i3 < ((ArrayList)localArrayList2.get(i1)).size())
//            break label1544;
   //     }
//          if (((WordList)localArrayList1.get(i)).getLearned().equals("0"))
//           localArrayList2.add(new ArrayList());
         while (true){
         // label219: ++i;
         // break label69:
          if (Integer.parseInt(((WordList)localArrayList1.get(i)).getReview_times()) >= 5)
            localArrayList2.add(new ArrayList());
          if (((WordList)localArrayList1.get(i)).getShouldReview().equals("1"))
          {
            Calendar localCalendar2 = Calendar.getInstance();
            switch (Integer.parseInt(((WordList)localArrayList1.get(i)).getReview_times()))
            {
            default:
              break;
            case 0:
              ArrayList localArrayList12 = new ArrayList();
              localArrayList12.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 1);
              localArrayList12.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 2);
              localArrayList12.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 3);
              localArrayList12.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 8);
              localArrayList12.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localArrayList2.add(localArrayList12);
              break;
            case 1:
              ArrayList localArrayList11 = new ArrayList();
              localArrayList11.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 2);
              localArrayList11.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 3);
              localArrayList11.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 8);
              localArrayList11.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localArrayList2.add(localArrayList11);
              break;
            case 2:
              ArrayList localArrayList10 = new ArrayList();
              localArrayList10.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 3);
              localArrayList10.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 8);
              localArrayList10.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localArrayList2.add(localArrayList10);
              break;
            case 3:
              ArrayList localArrayList9 = new ArrayList();
              localArrayList9.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localCalendar2.add(5, 8);
              localArrayList9.add(localSimpleDateFormat.format(localCalendar2.getTime()));
              localArrayList2.add(localArrayList9);
              break;
            case 4:
            }
            ArrayList localArrayList8 = new ArrayList();
            localArrayList8.add(localSimpleDateFormat.format(localCalendar2.getTime()));
            localArrayList2.add(localArrayList8);
          }
          if (!(((WordList)localArrayList1.get(i)).getShouldReview().equals("0")))
            continue;
          Calendar localCalendar1 = Calendar.getInstance();
          String str1;
          if (((WordList)localArrayList1.get(i)).getReview_times().equals("0"))
            str1 = ((WordList)localArrayList1.get(i)).getLearnedTime();
          while (true)
          {
            Object localObject = null;
            try
            {
              Date localDate = localSimpleDateFormat.parse(str1);
              localObject = localDate;
         //     label828: localCalendar1.setTime(localObject);
              switch (Integer.parseInt(((WordList)localArrayList1.get(i)).getReview_times()))
              {
              default:
                break;
              case 0:
                ArrayList localArrayList7 = new ArrayList();
                localCalendar1.add(5, 1);
                localArrayList7.add(localSimpleDateFormat.format(localCalendar1.getTime()));
                localCalendar1.add(5, 1);
                localArrayList7.add(localSimpleDateFormat.format(localCalendar1.getTime()));
                localCalendar1.add(5, 2);
                localArrayList7.add(localSimpleDateFormat.format(localCalendar1.getTime()));
                localCalendar1.add(5, 3);
                localArrayList7.add(localSimpleDateFormat.format(localCalendar1.getTime()));
                localCalendar1.add(5, 8);
                localArrayList7.add(localSimpleDateFormat.format(localCalendar1.getTime()));
                localArrayList2.add(localArrayList7);
               // break label219:
                str1 = ((WordList)localArrayList1.get(i)).getReviewTime();
              case 1:
              case 2:
              case 3:
              case 4:
              }
            }
            catch (ParseException localParseException)
            {
              localParseException.printStackTrace();
             // break label828:
              ArrayList localArrayList6 = new ArrayList();
              localCalendar1.add(5, 1);
              localArrayList6.add(localSimpleDateFormat.format(localCalendar1.getTime()));
              localCalendar1.add(5, 2);
              localArrayList6.add(localSimpleDateFormat.format(localCalendar1.getTime()));
              localCalendar1.add(5, 3);
              localArrayList6.add(localSimpleDateFormat.format(localCalendar1.getTime()));
              localCalendar1.add(5, 8);
              localArrayList6.add(localSimpleDateFormat.format(localCalendar1.getTime()));
              localArrayList2.add(localArrayList6);
            }
          }
          continue;
          ArrayList localArrayList5 = new ArrayList();
          localCalendar1.add(5, 2);
          localArrayList5.add(localSimpleDateFormat.format(localCalendar1.getTime()));
          localCalendar1.add(5, 3);
          localArrayList5.add(localSimpleDateFormat.format(localCalendar1.getTime()));
          localCalendar1.add(5, 8);
          localArrayList5.add(localSimpleDateFormat.format(localCalendar1.getTime()));
          localArrayList2.add(localArrayList5);
          continue;
          ArrayList localArrayList4 = new ArrayList();
          localCalendar1.add(5, 3);
          localArrayList4.add(localSimpleDateFormat.format(localCalendar1.getTime()));
          localCalendar1.add(5, 8);
          localArrayList4.add(localSimpleDateFormat.format(localCalendar1.getTime()));
          localArrayList2.add(localArrayList4);
          continue;
          ArrayList localArrayList3 = new ArrayList();
          localCalendar1.add(5, 8);
          localArrayList3.add(localSimpleDateFormat.format(localCalendar1.getTime()));
          localArrayList2.add(localArrayList3);
        }
        label1364: Log.i("List" + (j + 1), "have");
        for (int i5 = 0; ; ++i5)
        {
          if (i5 >= ((ArrayList)localArrayList2.get(j)).size())
            ++j;
           String str2 = i5+"";
          StringBuilder localStringBuilder = new StringBuilder("on");
           Log.i(str2, (String)((ArrayList)localArrayList2.get(j)).get(i5));
        }
        label1482: arrayOfString[k] = localSimpleDateFormat.format(localCalendar3.getTime());
        localCalendar3.add(5, 1);
        ++k;
      }
      ArrayList localArrayList14 = new ArrayList();
      localArrayList14.add(arrayOfString[l]);
      localArrayList13.add(localArrayList14);
    }
    for (int i4 = 0; ; ++i4)
    {
      if (i4 >= 7)
        label1544: ++i3;
      if (!(((String)((ArrayList)localArrayList2.get(i1)).get(i3)).equals(arrayOfString[i4])))
        continue;
      ((ArrayList)localArrayList13.get(i4)).add("List-" + (i1 + 1));
    }*/
  }

  public boolean ImportBook(Context paramContext, String paramString1, String paramString2, int paramInt, String paramString3)
    throws Exception
  {
    ifContinue = true;
    ArrayList localArrayList1 = new ArrayList();
    File localFile = new File("/sdcard/" + paramString1);
    Log.i("1", paramString1);
    BufferedReader localBufferedReader = new BufferedReader(new FileReader(localFile));
    int i = 1;
    int j = 1;
    String str = localBufferedReader.readLine();
    ArrayList localArrayList2;
    DataAccess localDataAccess;
    if (str == null)
    {
      localArrayList2 = initWordList(localArrayList1, paramString3);
      localDataAccess = new DataAccess(paramContext);
    }
    try
    {/*
      boolean bool2 = localDataAccess.initBook(paramString1, localArrayList2, String.valueOf(j), paramString2);
      boolean bool1 = bool2;
      return bool1;
      if (ifContinue)
      {
        if (i / paramInt > j)
          ++j;
        StringTokenizer localStringTokenizer = new StringTokenizer(str, "[,]");
        Word localWord = new Word();
        localWord.setID(String.valueOf(i));
        localWord.setList(String.valueOf(j));
        localWord.setSpelling(localStringTokenizer.nextToken());
        localWord.setPhonetic_alphabet("[" + localStringTokenizer.nextToken() + "]");
        localWord.setMeanning(localStringTokenizer.nextToken());
        localArrayList1.add(localWord);
        Log.i("Add word into list", localWord.getSpelling());
        ++i;
      }
      bool1 = false;*/
    }
    catch (Exception localException)
    {
      throw new Exception();
    }
	return false;
  }

  public void UpdateListInfo(Context paramContext)
  {
    Calendar localCalendar = Calendar.getInstance();
    SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    String str = localSimpleDateFormat.format(localCalendar.getTime());
    new ArrayList();
    DataAccess localDataAccess = new DataAccess(paramContext);
    ArrayList localArrayList = localDataAccess.QueryList(null, null);
    while (true)
    {/*
      int i;
      label62: Object localObject;
      try
      {
        Date localDate1 = localSimpleDateFormat.parse(str);
        i = 0;
        if (i >= localArrayList.size())
          break label370;
        label160: label212: label370: if (!(((WordList)localArrayList.get(i)).getShouldReview().equals("1")))
          if (!(((WordList)localArrayList.get(i)).getLearned().equals("0")))
            if (((WordList)localArrayList.get(i)).getReviewTime().equals(""))
            {
              localObject = localSimpleDateFormat.parse(((WordList)localArrayList.get(i)).getLearnedTime());
              switch (Integer.parseInt(((WordList)localArrayList.get(i)).getReview_times()))
              {
              case 1:
                long l = (localDate1.getTime() - ((Date)localObject).getTime()) / 86400000L;
                Log.i("Comparing " + localDate1.getTime() + " " + ((Date)localObject).getTime(), String.valueOf(l));
                if (l >= j)
                {
                  WordList localWordList = (WordList)localArrayList.get(i);
                  localWordList.setShouldReview("1");
                  localDataAccess.UpdateList(localWordList);
                }
              case 2:
              case 3:
              case 4:
              default:
              case 0:
              }
            }
      }
      catch (ParseException localParseException)
      {
        localParseException.printStackTrace();
        break label370:
        Date localDate2 = localSimpleDateFormat.parse(((WordList)localArrayList.get(i)).getReviewTime());
        localObject = localDate2;
        break label160:
        j = 1;
        break label212:
        j = 2;
        break label212:
        j = 3;
        break label212:
        j = 8;
        break label212:
        return;
      }
      while (true)
      {
        ++i;
        break label62:
      }
      int j = 1;*/
    }
  }

  public void setNotify(String paramString, Context paramContext)
  {
    StringTokenizer localStringTokenizer = new StringTokenizer(paramString, ":, ", false);
    int i = Integer.parseInt(localStringTokenizer.nextToken());
    int j = Integer.parseInt(localStringTokenizer.nextToken());
//    Log.i("hour", i);
//    Log.i("minute", j);
    Calendar localCalendar = Calendar.getInstance();
    if ((localCalendar.get(11) > i) || ((localCalendar.get(11) == i) && (localCalendar.get(12) >= j)))
      localCalendar.add(5, 1);
    localCalendar.set(11, i);
    localCalendar.set(12, j);
    localCalendar.set(13, 0);
    localCalendar.set(14, 0);
    Log.i("", new SimpleDateFormat("yyyy-MM-dd").format(localCalendar.getTime()));
    long l = localCalendar.getTimeInMillis();
    AlarmManager localAlarmManager = (AlarmManager)paramContext.getSystemService("alarm");
    Intent localIntent1 = new Intent(paramContext, makeNotify.class);
    localIntent1.setAction("shownotify");
    localAlarmManager.cancel(PendingIntent.getBroadcast(paramContext, 0, localIntent1, 0));
    Intent localIntent2 = new Intent(paramContext, makeNotify.class);
    localIntent2.setAction("shownotify");
    localAlarmManager.setRepeating(1, l, 86400000L, PendingIntent.getBroadcast(paramContext, 0, localIntent2, 0));
    Log.i("it's on", "on");
  }
}

/* Location:           E:\Desktop\Android\英语词汇记忆\classes_dex2jar.jar
 * Qualified Name:     wordroid.business.OperationOfBooks
 * JD-Core Version:    0.5.3
 */